inserting a node into a sorted doubly linked list hackerrank solution